Repository navigation
[DMD2 9/10] feat(dmd2): add the MiniMax H3 4-step DMD2 recipe with eval media and DMD2 metrics - #343
Conversation
d387c25 to
7d3283e
Compare
7d3283e to
c6ee19c
Compare
3117376 to
37695a1
Compare
| Dense / Data-Free recipe on `--loss-type dmd2`: full-parameter student and critic, frozen | ||
| teacher, lr 2e-6, 4 student steps with an Euler rollout stopped at a random step, an x0-space | ||
| critic, and 5 critic steps of 64 samples per student step. Prompts are the pinned | ||
| `vidprom_filtered_extended.txt` list, split by the script into fixed files with pinned hashes. |
There was a problem hiding this comment.
the dataset vidprom_filtered_extended.txt seems not present in this PR
| return str(prompt_dir) | ||
|
|
||
|
|
||
| def _fasth3_checkpoint(data_dir: str) -> str: |
There was a problem hiding this comment.
CC cmt
[P1] The FastH3 repo on the Hub is a complete pipeline (transformer, text_encoder, vae, audio_vae, scheduler, modular_model_index.json, same layout as FastVideo-FastH3-8-Step-V2 which sglang-d's bench preset loads by id), so the engines can take --hf-checkpoint FastVideo/FastVideo-FastH3-4-step-Preview-v1-Dense-DataFree directly and each node fetches it itself. This overlay is built only on the head node and links into the head's HF cache, so the second node's engines can't open it unless both /root/datasets and the HF cache are shared.
Please drop the overlay and pass the id plus --diffusion-model-family h3 (the name doesn't match H3's patterns); the cost is one extra 78 GB download per node.
There was a problem hiding this comment.
Done in ce6bda5: the overlay is gone, the reference run passes the Hub id and --diffusion-model-family h3.
93f1ff2 to
cf79748
Compare
…metrics to judge it
… reward reads the media
miles/ray/rollout.py imports imageio_ffmpeg to mux the eval audio; the GPU image had it only as a transitive dependency and the hosted CPU suite not at all, so tests/fast/rollout/test_eval_media.py failed to import there. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
cf79748 to
0f2b8e6
Compare
Ninth of the DMD2 stacked series, on top of #342. Adds the MiniMax H3 t2va 4-step DMD2 recipe for 2 nodes x 8 GPUs, and what is needed to judge a run by looking at it: eval videos at the right speed and with sound, kept on disk next to reference renders of the same prompts and seeds, plus distribution-matching and memory metrics.
What
scripts/run_diffusion_dmd2_h3_t2va_16gpu_multinode.py: FastVideo's FastH3 Preview v1 Dense / Data-Free recipe (fromcheckpoint_metadata.jsonofFastVideo/FastVideo-FastH3-4-step-Preview-v1-Dense-DataFree) on--loss-type dmd2:stop_at_random_stepbackward simulation,oderollout, unguided teacher;--dmd2-critic-loss-space x0,--dmd2-score-sigma-range 0.001 0.999,--fsdp-flow-shift visual=5.0;vidprom_filtered_extended.txt(248,221 lines, 248,219 unique prompts), downloaded and split deterministically by the script into train / test / a 26-prompteval_mediaset, with the output hashes pinned so every node builds the same files;--reference teacher|fasth3renders the eval set with MiniMax-H3 at 50 steps or with FastH3's student at 4 steps (the FastH3 checkpoint loaded by its Hub id on every node, with--diffusion-model-family h3since its name matches no H3 pattern), through--debug-rollout-onlyeval.--rm-type none: a constant 0 reward with no scorer, for a loss that reads none. The rollout still asks for a reward, and DMD2 has no use for one. With it (and no--custom-rm-path), training requests also sendrollout_return_generated_output=False, so the engine skips their VAE decode ([sglang-miles] [Diffusion] Let a rollout request skip the VAE decode sgl-project/sglang#46545); eval requests still decode.--rollout-video-dtypenow applies to eval responses too.--diffusion-fps(the hardcoded 8 stays the fallback); H3's config drops fps from the request, so the recipe sets 24 for playback only;imageio_ffmpeg's ffmpeg).Samplegainsgenerated_audio/audio_sample_rate, read from the rollout response'sgenerated_audio/audio_sample_ratewhen present;--save-eval-media-dir: every eval sample's file under<dir>/eval_<rollout_id>/with anindex.jsonlof prompt, seed and reward, independent of--wandb-log-num-images; such samples keep their media past scoring;RolloutManager.disposejoins the media threads, so the last eval (and a reference run, which ends right after it) is fully written and uploaded.dmd2_score_gap_abs_mean(mean |x0_fake − x0_real|),dmd2_teacher_dist_abs_mean(mean |x0 − x0_real|, g's normalizer),dmd2_x0_mean/dmd2_x0_std;dmd2_grad_abs_mean, the two above andx0_mean_abs_diffare also logged per stop step as<key>_step{i}, through aSTEP_SCHEMAfamily ofnew_metric_buffer(num_rollout_steps=...); a step no pair trained on logs nothing;peak_memory_allocated_gb(this process, since the previous step) anddevice_memory_used_gb(the whole GPU, so sleeping groups and the engine count) per optimizer step.Why
--eval-intervalwith the same seeds, and the two reference runs render the same prompts and seeds, so files with the same name compare directly.dmd2here.score_timestep_shift 2.4on its own clock, which FastGen-DMD documents as FastGen's score-time shift 5 (12 / 5 = 2.4);--fsdp-flow-shift visual=5.0gives that density on the sigma axis. Worth re-checking against FastVideo's training code once it is published.--rm-type none: miles' rm_hub hasrandom/deterministic_randomfor runs that do not need a real reward.Known gaps
generated_audio/audio_sample_rateto the rollout response; until it is in the image the saved videos are silent. The miles side here reads the fields when present.sglang-milesis the branchzhihengy/sglang:dmd2/h3-dmd2-e2e.Tests
tests/fast/backends/fsdp_utils/test_loss_hub_dmd2.py: the new metrics, overall and per stop step, on pairs with known teacher distance and score gap; steps no pair stopped at log nothing.tests/fast/rollout/test_eval_media.py: a video plays at the given fps (frame count and duration read back), the engine's audio ends up as a second stream with no leftover files, a single frame is a png, and_log_imageswith a save dir keeps every sample plusindex.jsonlwithout W&B.tests/fast/rollout/test_rm_none.py:nonegives 0 for every sample, globally and as a per-sample override.tests/fast/rollout/test_rollout_payload_media.py: training requests skip the decode only when no reward reads the media (nonewithout a custom reward); eval requests always decode; the video dtype reaches eval requests.tests/fast/rollout/test_release_eval_sample_media.py: saved eval media are kept past scoring; released samples also drop their audio.tests/fast/utils/test_diffusion_rollout_response.py: the response's audio fields fill the sample, and are absent when the engine sends none.--referencearg sets go throughmiles.utils.arguments.parse_argsand its DMD2 validation offline (global batch 320, scoring range, critic loss space, x0 flow shift, rm none, eval media dir).Checklist
pre-commithooks (black, isort, ruff at the pinned versions) pass on the changed filespytest tests/fast: 575 passed, 7 skipped; 4 tests fail in this environment and fail the same way on [DMD2 7/10] feat(dmd2): train the student with the distribution matching gradient from the critic group's scores #334 (test_hybrid_shard_mesh::test_mesh_axesandtest_metric_buffer_dist::test_metric_buffer_reduction, whose torchrun children import another checkout, and twotest_sft_h3_ref2va_encodercases)python3 train_diffusion.py --helpstill parses (--save-eval-media-diris listed)--save-eval-media-dir;--rm-type nonewith its decode skip, eval--rollout-video-dtype, and the--diffusion-fpsplayback use in their rows)Stack
DMD2: distill a flow-matching teacher into a few-step student with distribution matching. Merge in order:
external_data--loss-type dmd2on the actorOn top of this PR as well: #366 (the 2-GPU e2e of this recipe), #367 and #368 (hook registry and loop state refactors), #372 (the teacher forward in the trunk).
A GAN head and other follow-ups come after this series.